<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <link type="text/css" rel="stylesheet" href="../style.css" />
    <link type="text/css" rel="stylesheet" href="style.css" />
    <h:head>
        <title>WebShop</title>
    </h:head>
    <h:body styleClass="form">
        <h1>Index</h1>
        <p><br/><br/></p>
        <c:choose>
            <c:when test="#{authBackingBean.loggedIn()}">
                <c:choose>
                    <c:when test="#{authBackingBean.banned}">
                        <p>
                            <h:outputText value="you have been banned"/>
                            <br/>
                        </p>
                    </c:when>
                    <c:when test="#{authBackingBean.renderPage('shopMain')}">
                        <p>
                            <h:link value="go to shop page" outcome="shop" />
                            <br/>
                        </p>
                    </c:when>
                    <c:when test="#{authBackingBean.renderPage('adminMain')}">
                        <p>
                            <h:link value="go to admin page" outcome="admin" />
                            <br/>
                        </p>
                    </c:when>
                </c:choose>
                <h:form>
                    <h:commandLink id="logout" action="#{authBackingBean.logout()}" rendered="#{authBackingBean.loggedIn()}">
                        <p>
                            <h:outputText value="logout"/>
                        </p>
                    </h:commandLink>
                </h:form>
            </c:when>
            <c:otherwise>
                <p>
                    <h:link value="register" outcome="register" />
                    <br/>
                </p>
                <p>
                    <h:link value="go to shop page" outcome="shop" />
                    <br/>
                </p>
                <p>
                    <h:link value="go to admin page" outcome="admin"/>
                    <br/>
                </p>
            </c:otherwise>
        </c:choose>
    </h:body>
</html>

